import 'package:app/shared/constants/common.dart';
import 'package:flutter/material.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';

class PushContent extends StatefulWidget {
  PushContent({Key? key}) : super(key: key);

  @override
  _PushContentState createState() => _PushContentState();
}

class _PushContentState extends State<PushContent> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
          elevation: 0,
          title: Text(
            "发布话题",
            style: TextStyle(fontSize: 16, color: Colors.black),
          ),
          iconTheme: IconThemeData(
            color: Colors.black,
          ),
          actions: [
            TextButton(
                onPressed: () {},
                child: Container(
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(8),
                    color: sPrimaryColor,
                  ),
                  padding: EdgeInsets.symmetric(
                      vertical: sDefaultMarginPadding,
                      horizontal: sDefaultMarginPadding * 2),
                  child: Text(
                    "发布",
                    style: TextStyle(color: sTextColor),
                  ),
                ))
          ],
          backgroundColor: Colors.white),
      body: Container(
        child: Column(
          children: [
            Container(
              padding: EdgeInsets.all(sDefaultMarginPadding * 2),
              // height: 40,
              child: TextField(
                onChanged: (value) {
                  setState(() {});
                },
                minLines: 2,
                maxLines: 10,
                cursorColor: Colors.black,
                decoration: InputDecoration(
                  border: InputBorder.none,
                  hintText: '请输入...',
                ),
              ),
            ),
            Container(
              padding:
                  EdgeInsets.symmetric(horizontal: sDefaultMarginPadding * 2),
              child: Row(
                children: [
                  GestureDetector(
                      child: Container(
                        padding: EdgeInsets.all(40),
                        decoration: BoxDecoration(
                            color: Color.fromRGBO(231, 231, 231, .5),
                            borderRadius: BorderRadius.circular(10)),
                        child: Icon(
                          Icons.add,
                          color: Color.fromRGBO(200, 200, 200, 1),
                        ),
                      ),
                      onTap: () {
                        getImages();
                      })
                ],
              ),
            )
          ],
        ),
      ),
    );
  }

  getImages() async {
    final List<AssetEntity>? images =
        await AssetPicker.pickAssets(context, themeColor: sPrimaryColor);
    print(images);
  }
}
